home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 338_01 / c.h < prev    next >
Text File  |  1980-01-01  |  4KB  |  120 lines

  1. /*
  2.  *    68000 C compiler
  3.  *
  4.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  5.  *  all commercial rights reserved.
  6.  *
  7.  *    This compiler is intended as an instructive tool for personal use. Any
  8.  *    use for profit without the written consent of the author is prohibited.
  9.  *
  10.  *    This compiler may be distributed freely for non-commercial use as long
  11.  *    as this notice stays intact. Please forward any enhancements or questions
  12.  *    to:
  13.  *
  14.  *        Matthew Brandt
  15.  *        Box 920337
  16.  *        Norcross, Ga 30092
  17.  */
  18.  
  19. /*      compiler header file    */
  20.  
  21. enum e_sym {
  22.         id, cconst, iconst, lconst, sconst, rconst, plus, minus,
  23.         star, divide, lshift, rshift, modop, eq, neq, lt, leq, gt,
  24.         geq, assign, asplus, asminus, astimes, asdivide, asmodop,
  25.         aslshift, asrshift, asand, asor, autoinc, autodec, hook, compl,
  26.         comma, colon, semicolon, uparrow, openbr, closebr, begin, end,
  27.         openpa, closepa, pointsto, dot, lor, land, not, or, and, kw_int,
  28.         kw_void, kw_char, kw_float, kw_double, kw_struct, kw_union,
  29.         kw_long, kw_short, kw_unsigned, kw_auto, kw_extern,
  30.         kw_register, kw_typedef, kw_static, kw_goto, kw_return,
  31.         kw_sizeof, kw_break, kw_continue, kw_if, kw_else, kw_for,
  32.         kw_do, kw_while, kw_switch, kw_case, kw_default, kw_enum,
  33.         eof };
  34.  
  35. enum e_sc {
  36.         sc_static, sc_auto, sc_global, sc_external, sc_type, sc_const,
  37.         sc_member, sc_label, sc_ulabel };
  38.  
  39. enum e_bt {
  40.         bt_char, bt_short, bt_long, bt_float, bt_double, bt_pointer,
  41.         bt_unsigned, bt_struct, bt_union, bt_enum, bt_func, bt_ifunc};
  42.  
  43. struct slit {
  44.         struct slit     *next;
  45.         int             label;
  46.         char            *str;
  47.         };
  48.  
  49. struct sym {
  50.         struct sym      *next;
  51.         char            *name;
  52.         int               storage_class;
  53.         union   {
  54.                 long            i;
  55.                 unsigned        u;
  56.                 double          f;
  57.                 char            *s;
  58.                 }
  59.                         value;
  60.  
  61.         struct typ {
  62.                 int               type;
  63.                 char            val_flag;       /* is it a value type */
  64.                 long            size;
  65.                 struct stab {
  66.                         struct sym      *head, *tail;
  67.                         }       lst;
  68.                 struct typ      *btp;
  69.                 char            *sname;
  70.                 }
  71.                         *tp;
  72.         };
  73.  
  74. #define SYM     struct sym
  75. #define TYP     struct typ
  76. #define TABLE   struct stab
  77.  
  78. #define MAX_STRLEN      120
  79. #define MAX_STLP1       121
  80. #define ERR_SYNTAX      0
  81. #define ERR_ILLCHAR     1
  82. #define ERR_FPCON       2
  83. #define ERR_ILLTYPE     3
  84. #define ERR_UNDEFINED   4
  85. #define ERR_DUPSYM      5
  86. #define ERR_PUNCT       6
  87. #define ERR_IDEXPECT    7
  88. #define ERR_NOINIT      8
  89. #define ERR_INCOMPLETE  9
  90. #define ERR_ILLINIT     10
  91. #define ERR_INITSIZE    11
  92. #define ERR_ILLCLASS    12
  93. #define ERR_BLOCK       13
  94. #define ERR_NOPOINTER   14
  95. #define ERR_NOFUNC      15
  96. #define ERR_NOMEMBER    16
  97. #define ERR_LVALUE      17
  98. #define ERR_DEREF       18
  99. #define ERR_MISMATCH    19
  100. #define ERR_EXPREXPECT  20
  101. #define ERR_WHILEXPECT  21
  102. #define ERR_NOCASE      22
  103. #define ERR_DUPCASE     23
  104. #define ERR_LABEL       24
  105. #define ERR_PREPROC     25
  106. #define ERR_INCLFILE    26
  107. #define ERR_CANTOPEN    27
  108. #define ERR_DEFINE      28
  109.  
  110. /*      alignment sizes         */
  111.  
  112. #define AL_CHAR         1
  113. #define AL_SHORT        2
  114. #define AL_LONG         2
  115. #define AL_POINTER      2
  116. #define AL_FLOAT        2
  117. #define AL_DOUBLE       2
  118. #define AL_STRUCT       2
  119.  
  120.